package weiy.top.modules.brand.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import weiy.top.modules.brand.entity.PmsBrand;
import weiy.top.modules.brand.mapper.PmsBrandMapper;
import weiy.top.modules.brand.service.IPmsBrandService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import weiy.top.modules.category.service.IPmsCategoryBrandRelationService;

/**
 * @Description: pms_brand
 * @Author: weihancheng
 * @Date:   2021-11-24
 * @Version: V1.0
 */
@Service
public class PmsBrandServiceImpl extends ServiceImpl<PmsBrandMapper, PmsBrand> implements IPmsBrandService {
    @Autowired
    private IPmsCategoryBrandRelationService categoryBrandRelationService;

    @Override
    public void updateByIdMain(PmsBrand brand) {
        this.updateById(brand);

        String brandId = brand.getBrandId();
        String name = brand.getName();

        // 通知中间表修改数据
        categoryBrandRelationService.updateAllBrand(brandId, name);
    }
}
